.class public Lcn/cheln/support/adapter/a;
.super Ljava/lang/Object;


# instance fields
.field private a:Ljava/util/Map;

.field private b:Ljava/util/List;

.field private c:Landroid/database/Cursor;

.field private d:Ljava/util/List;

.field private e:I

.field private f:Ljava/util/Map;

.field private g:I


# direct methods
.method public constructor <init>()V
    .locals 2

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    new-instance v0, Ljava/util/TreeMap;

    new-instance v1, Lcn/cheln/support/adapter/b;

    invoke-direct {v1}, Lcn/cheln/support/adapter/b;-><init>()V

    invoke-direct {v0, v1}, Ljava/util/TreeMap;-><init>(Ljava/util/Comparator;)V

    iput-object v0, p0, Lcn/cheln/support/adapter/a;->a:Ljava/util/Map;

    const/4 v0, -0x1

    iput v0, p0, Lcn/cheln/support/adapter/a;->e:I

    return-void
.end method

.method public constructor <init>(Landroid/database/Cursor;Ljava/util/Map;)V
    .locals 4

    const/4 v2, 0x1

    const-string v3, " "

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    new-instance v0, Ljava/util/TreeMap;

    new-instance v1, Lcn/cheln/support/adapter/b;

    invoke-direct {v1}, Lcn/cheln/support/adapter/b;-><init>()V

    invoke-direct {v0, v1}, Ljava/util/TreeMap;-><init>(Ljava/util/Comparator;)V

    iput-object v0, p0, Lcn/cheln/support/adapter/a;->a:Ljava/util/Map;

    const/4 v0, -0x1

    iput v0, p0, Lcn/cheln/support/adapter/a;->e:I

    iget-object v0, p0, Lcn/cheln/support/adapter/a;->a:Ljava/util/Map;

    invoke-interface {p1}, Landroid/database/Cursor;->getCount()I

    move-result v1

    sub-int/2addr v1, v2

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    invoke-interface {v0, v1, p1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "put "

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-interface {p1}, Landroid/database/Cursor;->getCount()I

    move-result v1

    sub-int/2addr v1, v2

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " "

    invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, " "

    invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-interface {p1}, Landroid/database/Cursor;->getCount()I

    move-result v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcn/cheln/support/app/c;->a(Ljava/lang/String;)V

    invoke-direct {p0, p1, p2}, Lcn/cheln/support/adapter/a;->a(Landroid/database/Cursor;Ljava/util/Map;)V

    iget v0, p0, Lcn/cheln/support/adapter/a;->g:I

    invoke-interface {p1}, Landroid/database/Cursor;->getCount()I

    move-result v1

    add-int/2addr v0, v1

    iput v0, p0, Lcn/cheln/support/adapter/a;->g:I

    return-void
.end method

.method public constructor <init>(Ljava/util/List;)V
    .locals 2

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    new-instance v0, Ljava/util/TreeMap;

    new-instance v1, Lcn/cheln/support/adapter/b;

    invoke-direct {v1}, Lcn/cheln/support/adapter/b;-><init>()V

    invoke-direct {v0, v1}, Ljava/util/TreeMap;-><init>(Ljava/util/Comparator;)V

    iput-object v0, p0, Lcn/cheln/support/adapter/a;->a:Ljava/util/Map;

    const/4 v0, -0x1

    iput v0, p0, Lcn/cheln/support/adapter/a;->e:I

    if-nez p1, :cond_0

    new-instance v0, Ljava/lang/NullPointerException;

    const-string v1, "list is null"

    invoke-direct {v0, v1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V

    throw v0

    :cond_0
    iput-object p1, p0, Lcn/cheln/support/adapter/a;->d:Ljava/util/List;

    const/4 v0, 0x1

    iput v0, p0, Lcn/cheln/support/adapter/a;->e:I

    return-void
.end method

.method private a(Landroid/database/Cursor;Ljava/util/Map;)V
    .locals 2

    if-nez p1, :cond_0

    new-instance v0, Ljava/lang/NullPointerException;

    const-string v1, "cursor is null"

    invoke-direct {v0, v1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V

    throw v0

    :cond_0
    iput-object p1, p0, Lcn/cheln/support/adapter/a;->c:Landroid/database/Cursor;

    const/4 v0, 0x0

    iput v0, p0, Lcn/cheln/support/adapter/a;->e:I

    iput-object p2, p0, Lcn/cheln/support/adapter/a;->f:Ljava/util/Map;

    return-void
.end method


# virtual methods
.method public a(I)Ljava/lang/Object;
    .locals 6

    const/4 v5, 0x1

    const/4 v4, 0x0

    iget v0, p0, Lcn/cheln/support/adapter/a;->e:I

    packed-switch v0, :pswitch_data_0

    move-object v0, v4

    :goto_0
    return-object v0

    :pswitch_0
    iget-object v0, p0, Lcn/cheln/support/adapter/a;->b:Ljava/util/List;

    if-nez v0, :cond_0

    new-instance v0, Ljava/util/ArrayList;

    iget-object v1, p0, Lcn/cheln/support/adapter/a;->a:Ljava/util/Map;

    invoke-interface {v1}, Ljava/util/Map;->keySet()Ljava/util/Set;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(Ljava/util/Collection;)V

    iput-object v0, p0, Lcn/cheln/support/adapter/a;->b:Ljava/util/List;

    :cond_0
    iget-object v0, p0, Lcn/cheln/support/adapter/a;->b:Ljava/util/List;

    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    invoke-static {v0, v1}, Ljava/util/Collections;->binarySearch(Ljava/util/List;Ljava/lang/Object;)I

    move-result v0

    if-gez v0, :cond_1

    neg-int v0, v0

    sub-int/2addr v0, v5

    move v1, v0

    :goto_1
    iget-object v0, p0, Lcn/cheln/support/adapter/a;->b:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-ge v1, v0, :cond_6

    iget-object v0, p0, Lcn/cheln/support/adapter/a;->b:Ljava/util/List;

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Integer;

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    iget-object v2, p0, Lcn/cheln/support/adapter/a;->a:Ljava/util/Map;

    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v3

    invoke-interface {v2, v3}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Landroid/database/Cursor;

    invoke-interface {p0}, Landroid/database/Cursor;->getCount()I

    move-result v2

    if-nez v2, :cond_2

    move-object v0, v4

    goto :goto_0

    :cond_1
    move v1, v0

    goto :goto_1

    :cond_2
    if-nez v1, :cond_3

    move v0, p1

    :goto_2
    if-eqz p0, :cond_4

    invoke-interface {p0}, Landroid/database/Cursor;->isClosed()Z

    move-result v1

    if-eqz v1, :cond_4

    move-object v0, p0

    goto :goto_0

    :cond_3
    sub-int v1, v2, v5

    sub-int/2addr v0, p1

    sub-int v0, v1, v0

    goto :goto_2

    :cond_4
    invoke-interface {p0, v0}, Landroid/database/Cursor;->moveToPosition(I)Z

    move-object v0, p0

    goto :goto_0

    :pswitch_1
    iget-object v0, p0, Lcn/cheln/support/adapter/a;->d:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    if-ge p1, v0, :cond_5

    iget-object v0, p0, Lcn/cheln/support/adapter/a;->d:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    goto :goto_0

    :cond_5
    move-object v0, v4

    goto :goto_0

    :cond_6
    move-object v0, v4

    goto :goto_0

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method

.method public final a()Ljava/util/Map;
    .locals 1

    iget-object v0, p0, Lcn/cheln/support/adapter/a;->f:Ljava/util/Map;

    return-object v0
.end method

.method public final a(Landroid/database/Cursor;)V
    .locals 3

    iget-object v0, p0, Lcn/cheln/support/adapter/a;->f:Ljava/util/Map;

    invoke-direct {p0, p1, v0}, Lcn/cheln/support/adapter/a;->a(Landroid/database/Cursor;Ljava/util/Map;)V

    invoke-interface {p1}, Landroid/database/Cursor;->getCount()I

    move-result v0

    if-nez v0, :cond_0

    const/4 v0, -0x1

    :goto_0
    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v0

    iget-object v1, p0, Lcn/cheln/support/adapter/a;->a:Ljava/util/Map;

    invoke-interface {v1, v0, p1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    iget v0, p0, Lcn/cheln/support/adapter/a;->g:I

    invoke-interface {p1}, Landroid/database/Cursor;->getCount()I

    move-result v1

    add-int/2addr v0, v1

    iput v0, p0, Lcn/cheln/support/adapter/a;->g:I

    return-void

    :cond_0
    iget-object v0, p0, Lcn/cheln/support/adapter/a;->a:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->keySet()Ljava/util/Set;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Set;->toArray()[Ljava/lang/Object;

    move-result-object v0

    iget-object v1, p0, Lcn/cheln/support/adapter/a;->a:Ljava/util/Map;

    invoke-interface {v1}, Ljava/util/Map;->size()I

    move-result v1

    const/4 v2, 0x1

    sub-int/2addr v1, v2

    aget-object v0, v0, v1

    check-cast v0, Ljava/lang/Integer;

    invoke-virtual {v0}, Ljava/lang/Integer;->intValue()I

    move-result v0

    invoke-interface {p1}, Landroid/database/Cursor;->getCount()I

    move-result v1

    add-int/2addr v0, v1

    goto :goto_0
.end method

.method public final b()Ljava/lang/Object;
    .locals 1

    iget v0, p0, Lcn/cheln/support/adapter/a;->e:I

    packed-switch v0, :pswitch_data_0

    const/4 v0, 0x0

    :goto_0
    return-object v0

    :pswitch_0
    iget-object v0, p0, Lcn/cheln/support/adapter/a;->c:Landroid/database/Cursor;

    goto :goto_0

    :pswitch_1
    iget-object v0, p0, Lcn/cheln/support/adapter/a;->d:Ljava/util/List;

    goto :goto_0

    nop

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method

.method public final c()V
    .locals 2

    iget v0, p0, Lcn/cheln/support/adapter/a;->e:I

    if-nez v0, :cond_1

    const/4 v0, 0x0

    iput-object v0, p0, Lcn/cheln/support/adapter/a;->c:Landroid/database/Cursor;

    iget-object v0, p0, Lcn/cheln/support/adapter/a;->a:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->clear()V

    :cond_0
    :goto_0
    return-void

    :cond_1
    iget v0, p0, Lcn/cheln/support/adapter/a;->e:I

    const/4 v1, 0x1

    if-ne v0, v1, :cond_0

    iget-object v0, p0, Lcn/cheln/support/adapter/a;->d:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->clear()V

    goto :goto_0
.end method

.method public final d()I
    .locals 2

    const/4 v1, 0x0

    iget v0, p0, Lcn/cheln/support/adapter/a;->e:I

    packed-switch v0, :pswitch_data_0

    move v0, v1

    :goto_0
    return v0

    :pswitch_0
    iget-object v0, p0, Lcn/cheln/support/adapter/a;->c:Landroid/database/Cursor;

    if-nez v0, :cond_0

    move v0, v1

    goto :goto_0

    :cond_0
    iget v0, p0, Lcn/cheln/support/adapter/a;->g:I

    goto :goto_0

    :pswitch_1
    iget-object v0, p0, Lcn/cheln/support/adapter/a;->d:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->size()I

    move-result v0

    goto :goto_0

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method
